import turtle

def up_goto(pos):
    """画笔抬起移动到某个位置"""
    turtle.up()
    turtle.goto(pos)
    turtle.down()

def zhen(size, dis, count):
    """
    画时分秒针
    :param size: 画笔粗细
    :param dis: 长度
    :param count: 转动的数量
    :return:
    """
    up_goto((0,0))
    turtle.right(count*6-90)
    turtle.pensize(size)
    turtle.forward(dis)
    turtle.backward(dis)
    turtle.left(count*6-90)

def clock():
    """
    画表盘
    :return:
    """
    turtle.pensize(5)
    for i in range(1, 61):
        turtle.up()
        turtle.circle(-200, 6)
        turtle.down()
        if i % 5 == 0:
            turtle.left(90)
            turtle.forward(10)

            if i // 5 <= 3 or i // 5 >= 9:
                turtle.up()
                turtle.forward(10)
                turtle.write(i // 5, False, 'center', ('Arial', 16, 'normal'))
                turtle.backward(20)
                turtle.down()

            else:
                turtle.up()
                turtle.forward(20)
                turtle.write(i // 5, False, 'center', ('Arial', 16, 'normal'))
                turtle.backward(30)
                turtle.down()

            turtle.right(90)
        else:
            turtle.dot(5)


def update_time(h, m, s):
    """
    更新时间
    :param h: 时
    :param m: 分
    :param s: 秒
    :return: h m  s
    """
    s+=1
    if s>=60:
        s = 0
        m+=1
        if m>=60:
            s+=1
            if s>=12:
                s=0
    return h, m, s

def draw_date():
    """
    绘制日期
    :return:
    """
    up_goto((0, 100))
    turtle.write("2021-08-03", False, 'center',("Arial", 16, 'normal'))
def draw():
    """绘制"""
    global  s, m, h
    turtle.clear()
    up_goto((0, 200))
    clock()
    draw_date()
    zhen(3, 150, s)
    zhen(6, 100, m)
    zhen(10, 50, h)
    zhen(10, 300, h)
    h, m, s = update_time(h, m, s)
    turtle.ontimer(draw, 200)


turtle.tracer(False)
h, m, s = 0, 0, 0
turtle.speed(0)
up_goto((0, 200))
draw()
turtle.done()